Ever since San Antonio confirmed its first COVID-19 case more than one year ago, the COVID-19 pandemic and the associated social and economic fallout have upended the lives of many locally. The significant social and economic disruptions have caused tremendous stress for virtually everyone in our communities. The pandemic has challenged people’s everyday routines on an unprecedented scale. Joblessness remains high and many report that their households lack sufficient food to eat or are not able to make rental, medical, utility bill payments. These significant stressors following COVID-19 could exert negative impacts on people’s physical and mental health. The potential economic hardship and health consequences following the pandemic are likely to be unequally distributed and shaped by different ecological structure of local neighborhood conditions. In this policy brief, we compare and contrast two neighborhoods with drastic differences in racial and ethnic composition and socioeconomic status. [maybe add a sentence or two about families with dependent, childcare, etc]
-questionnaire design
The San Antonio Energy and Time Use Survey is an online survey that was answered between March 22-24 by residents of zip codes 78230 (referred to as Elm Creek) and 78202 (referred to as Jefferson Heights). The household level questionnaire collects information on time use, energy consumption, health status and medical devices, employment situation and demographic characteristics. Upon completion of the survey, respondents received a $10 Target e-gift card as a compensation for their time. We specifically chose two study sites that are different from each other in terms of racial and ethnic composition and socioeconomic conditions. Elm Creek neighborhood (zip code 78230), located at XXX, … [describe the neighborhood characteristics here] Whereas Jefferson Heights—a disadvantaged neighborhood located at XXX. [describe the neighborhood characteristics here. From census data, show basic demographic and socioeconomic data of each neighborhood. Highlight the disparities in racial composition, average HH income, and unemployment rate.] The study was approved by UTSA IRB.
We launched our online survey on [date] on [platform]. From XX to XX, we collected XX survey respondents, of which XX were valid responses with complete information on key demographic and socioeconomic information. We further excluded XX respondents due to lack of information on XXX (I don’t remember the process we used to finalize our sample. Did we drop a few because the zipcodes reported were not in the study sites? Please complete this section.) The final analytical sample consists of XX respondents in total, of which XX are from Elm Creek and XX are from Jefferson Heights.
With the information obtained from this source, we present a snapshot of the employment loss hardships experienced by these San Antonio residents.
Since the onset of COVID-19 (March 2020), 57.4% experienced the loss of employment income. This figure was 60% in Elm Creek and 40% in Jefferson Heights. Figure 1 also shows the percentage of residents by race and ethnicity who experienced job loss.
loss %>%
ggplot(aes(x = zipcode, y = pct, fill = race_eth2)) +
geom_bar(stat = "identity", position = "dodge", color = "gray30") +
geom_text(aes(label = lbl), size = 6.5, color = "gray30", position = position_dodge(width = .9), vjust = -.7, family = "foo") +
scale_y_continuous(limits = c(0, .60), breaks = seq(0, 1, .15), label = scales::percent) +
scale_fill_jama() +
labs(y = NULL, x = NULL, fill = NULL,
title = str_wrap("Figure 1. Loss of employment by race and ethnicity", width = 75),
subtitle = str_wrap("Since the onset of COVID-19 (March 2020), has anyone in this household experienced the loss of employment income"),
caption = "Source: 2021 San Antonio Energy and Time Use Survey") +
theme_classic() +
themeuloss %>%
ggplot(aes(x = pct, y = reorder(race_eth2, pct), color = zipcode)) +
geom_point(stat = "identity", size = 5) +
geom_text_repel(aes(label = lbl), size = 6, color = "gray30", segment.alpha = 0, family = "foo", nudge_y = .3, nudge_x = .01) +
scale_x_continuous(limits = c(0, .5), breaks = seq(0, 1, .15), label = scales::percent) +
scale_color_manual(values = wes_palette("Darjeeling2", n = 3)) +
guides(color = guide_legend(label.position = "left", label.vjust = 0.5, label.hjust = 1)) +
labs(y = NULL, x = NULL, color = NULL,
title = "Figure 1. Loss of employment by race and ethnicity",
subtitle = str_wrap("Since the onset of COVID-19 (March 2020), has anyone in this household experienced the loss of employment income"),
caption = "Source: 2021 San Antonio Energy and Time Use Survey") +
theme_classic() +
themeufloss %>%
ggplot(aes(x = pct, y = reorder(race_eth2, pct), color = zipcode)) +
geom_point(stat = "identity", aes(size = n)) +
geom_text_repel(aes(label = lbl), size = 6, color = "gray30", segment.alpha = 0, family = "foo", nudge_y = .3, nudge_x = .01) +
scale_x_continuous(limits = c(0, .5), breaks = seq(0, 1, .15), label = scales::percent) +
scale_color_manual(values = wes_palette("Darjeeling2", n = 3)) +
guides(color = guide_legend(label.position = "left", label.vjust = 0.5, label.hjust = 1, override.aes = list(size = 5)),
size = FALSE) +
labs(y = NULL, x = NULL, color = NULL, size = NULL,
title = "Figure 1. Loss of employment by race and ethnicity",
subtitle = str_wrap("Since the onset of COVID-19 (March 2020), has anyone in this household experienced the loss of employment income"),
caption = "Source: 2021 San Antonio Energy and Time Use Survey") +
theme_classic() +
themeufThe impacts of the pandemic are particularly prevalent among African American, Latinx, indigenous, and immigrant households. One representation of long-standing inequalities and an orderly system that reinforces the inequality gap between the different groups.
In many cases, job loss also represents loss of main income for the household, specially in households with dependents. In such cases, paying for the necessary food, the utility bills or rent/mortgage, can turn dramatically into more hardships to deal with during this pandemic.
An adequate state of health would be difficult to achieve under these conditions. In Figure 2 we show the self-reported health status among those respondents who lost their jobs.
lossxhealth %>%
ggplot(aes(x = zipcode, y = pct, fill = health)) +
geom_bar(stat = "identity", position = "dodge", color = "gray30") +
geom_text(aes(label = lbl), size = 7, color = "gray30", position = position_dodge(width = .9), vjust = -.7, family = "foo") +
scale_y_continuous(limits = c(0, .60), breaks = seq(0, 1, .15), label = scales::percent) +
scale_fill_manual(values = wes_palette(name = "Zissou1", n = 5)) +
labs(y = NULL,
fill = NULL,
x = NULL,
title = str_wrap("Figure 2. Self-rated health status distribution among those who lost their job", width = 60),
subtitle = str_wrap("Since the onset of COVID-19 (March 2020), has anyone in this household experienced the loss of employment income"),
caption = "Source: 2021 San Antonio Energy and Time Use Survey") +
theme_classic() +
themeulossxhealth %>%
ggplot(aes(color = zipcode, x = pct, y = health)) +
geom_point(stat = "identity", size = 5) +
geom_text_repel(aes(label = lbl), size = 6, color = "gray30", segment.alpha = 0, family = "foo", nudge_y = .3, nudge_x = .01) +
scale_x_continuous(limits = c(0, .5), breaks = seq(0, 1, .15), label = scales::percent) +
scale_y_discrete(limits = rev(levels(data$health))) +
scale_color_manual(values = wes_palette("Darjeeling2", n = 3)) +
labs(y = NULL, x = NULL, color = NULL,
title = str_wrap("Figure 2. Self-rated health status distribution among those who lost their job", width = 60),
subtitle = str_wrap("Since the onset of COVID-19 (March 2020), has anyone in this household experienced the loss of employment income"),
caption = "Source: 2021 San Antonio Energy and Time Use Survey") +
theme_classic() +
themeuflossxhealth %>%
ggplot(aes(color = zipcode, x = pct, y = health)) +
geom_point(stat = "identity", aes(size = n)) +
geom_text_repel(aes(label = lbl), size = 6, color = "gray30", segment.alpha = 0, family = "foo", nudge_y = .3, nudge_x = .01) +
scale_x_continuous(limits = c(0, .5), breaks = seq(0, 1, .15), label = scales::percent) +
scale_y_discrete(limits = rev(levels(data$health))) +
scale_color_manual(values = wes_palette("Darjeeling2", n = 3)) +
guides(color = guide_legend(label.position = "left", label.vjust = 0.5, label.hjust = 1, override.aes = list(size = 5)),
size = FALSE) +
labs(y = NULL, x = NULL, color = NULL,
title = str_wrap("Figure 2. Self-rated health status distribution among those who lost their job", width = 60),
subtitle = str_wrap("Since the onset of COVID-19 (March 2020), has anyone in this household experienced the loss of employment income"),
caption = "Source: 2021 San Antonio Energy and Time Use Survey") +
theme_classic() +
themeufWe present the average number of days with not good physical health and mental health among those who lost their job.
lossxhealth2 %>%
mutate(label = ph.mean) %>%
ggplot(aes(x = ph.mean, y = reorder(race_eth2, ph.mean))) +
geom_line(color = "gray70", size = 1) +
geom_point(aes(color = depen, size = n), shape = 19) +
facet_grid(~zipcode) +
geom_text_repel(aes(label = label, x = ph.mean), size = 6, color = "gray30", nudge_y = .31, segment.alpha = 0, family = "foo") +
scale_color_igv(palette = "alternating") +
scale_x_continuous(limits = c(0, 5), breaks = seq(0, 5, 1)) +
guides(color = guide_legend(label.position = "left", label.vjust = 0.5, label.hjust = 1, override.aes = list(size = 5)),
size = FALSE) +
labs(y = NULL,
color = "Do you have any dependents?",
x = "Number of days",
title = str_wrap("For how many days during the past 30 days was your physical health not good?", width = 50),
subtitle = str_wrap("We show the average number of days without good physical health by race and ethnicity", width = 65),
caption = "Source: 2021 San Antonio Energy and Time Use Survey") +
theme_classic() +
themeuf lossxhealth2 %>%
mutate(label = mh.mean) %>%
ggplot(aes(x = mh.mean, y = reorder(race_eth2, mh.mean))) +
geom_line(color = "gray70", size = 1) +
geom_point(aes(color = depen, size = n), shape = 19) +
facet_grid(~zipcode) +
geom_text_repel(aes(label = label, x = mh.mean), size = 6, color = "gray30", nudge_y = .31, segment.alpha = 0, family = "foo") +
scale_color_igv(palette = "alternating") +
scale_x_continuous(limits = c(0, 12), breaks = seq(0, 12, 2)) +
guides(color = guide_legend(label.position = "left", label.vjust = 0.5, label.hjust = 1, override.aes = list(size = 5)),
size = FALSE) +
labs(y = NULL,
x = "Number of days",
color = "Do you have any dependents?",
title = str_wrap("For how many days during the past 30 days was your mental health not good?", width = 50),
subtitle = str_wrap("We show the average number of days without good mental health by race and ethnicity", width = 65),
caption = "Source: 2021 San Antonio Energy and Time Use Survey") +
theme_classic() +
themeufWe present the average number of days with not good physical health and mental health among those who lost their job and experienced two more hardships like difficulty in paying utility bills, in affording the kinds of food you need, in paying next rent or mortgage payment, in paying medical bill/health insurance, add delay getting/Do not get medical care or prescription medication.
lossxbad2 <- data %>%
filter(bad == "More than two", hardships_1 == 1) %>%
group_by(zipcode, race_eth2, depen) %>%
summarize(ph.mean = round(mean(physical_health), 1),
mh.mean = round(mean(mental_health), 1),
n = n())
lossxbad2 %>%
mutate(label = ph.mean) %>%
ggplot(aes(x = ph.mean, y = reorder(race_eth2, ph.mean))) +
geom_line(color = "gray70", size = 1) +
geom_point(aes(color = depen, size = n), shape = 19) +
facet_grid(~zipcode) +
geom_text(aes(label = label, x = ph.mean), size = 6, color = "gray30", nudge_y = .3) +
scale_color_igv(palette = "alternating") +
scale_x_continuous(limits = c(0, 7), breaks = seq(0, 7, 1)) +
guides(color = guide_legend(label.position = "left", label.vjust = 0.5, label.hjust = 1, override.aes = list(size = 5)),
size = FALSE) +
labs(y = NULL, x = "Number of days",
color = "Do you have any dependents?",
title = str_wrap("For how many days during the past 30 days was your physical health not good?", width = 50),
subtitle = str_wrap("We show the average number of days without good physical health by race and ethnicity among those with more than two hardships",
width = 65),
caption = "Source: 2021 San Antonio Energy and Time Use Survey") +
theme_classic() +
themeuflossxbad2 %>%
mutate(label = mh.mean) %>%
ggplot(aes(x = mh.mean, y = reorder(race_eth2, mh.mean))) +
geom_line(color = "gray70", size = 1) +
geom_point(aes(color = depen, size = n), shape = 19) +
facet_grid(~zipcode) +
geom_text_repel(aes(label = label, x = mh.mean), size = 6, color = "gray30", nudge_y = .3, segment.alpha = 0) +
scale_color_igv(palette = "alternating") +
scale_x_continuous(limits = c(0, 15), breaks = seq(0, 15, 3)) +
guides(color = guide_legend(label.position = "left", label.vjust = 0.5, label.hjust = 1, override.aes = list(size = 5)),
size = FALSE) +
labs(y = NULL, x = "Number of days",
color = "Do you have any dependents?",
title = str_wrap("For how many days during the past 30 days was your mental health not good?", width = 50),
subtitle = str_wrap("We show the average number of days without good mental health by race and ethnicity among those with more than two hardships",
width = 65),
caption = "Source: 2021 San Antonio Energy and Time Use Survey") +
theme_classic() +
themeufemployed_pct %>%
ggplot(aes(x = pct, y = reorder(race_eth2, pct),color = zipcode)) +
geom_point(stat = "identity", size = 5) +
geom_text_repel(aes(label = lbl), size = 6, color = "gray30", segment.alpha = 0, family = "foo", nudge_y = .3, nudge_x = .01) +
scale_x_continuous(limits = c(0, 1), breaks = c(0,0.2,0.4,0.6,0.8,1.0), label = scales::percent) +
scale_color_manual(values = wes_palette("Darjeeling2", n = 3)) +
guides(color = guide_legend(label.position = "left", label.vjust = 0.5, label.hjust = 1)) +
labs(y = NULL, x = NULL, color = NULL,
title = "Figure 1. Employment Status: Employed by race and ethnicity",
subtitle = str_wrap("In the last seven days, what is your employment status?"),
caption = "Source: 2021 San Antonio Energy and Time Use Survey") +
theme_classic() +
themeufunemployed_pct %>%
ggplot(aes(x = pct, y = reorder(race_eth2, pct),color = zipcode)) +
geom_point(stat = "identity", size = 5) +
geom_text_repel(aes(label = lbl), size = 6, color = "gray30", segment.alpha = 0, family = "foo", nudge_y = .3, nudge_x = .01) +
scale_x_continuous(label = scales::percent) +
scale_color_manual(values = wes_palette("Darjeeling2", n = 3)) +
guides(color = guide_legend(label.position = "left", label.vjust = 0.5, label.hjust = 1)) +
labs(y = NULL, x = NULL, color = NULL,
title = "Figure 2. Employment Status: Unemployed by race and ethnicity",
subtitle = str_wrap("In the last seven days, what is your employment status?"),
caption = "Source: 2021 San Antonio Energy and Time Use Survey") +
theme_classic() +
themeufretired_pct %>%
ggplot(aes(x = pct, y = reorder(race_eth2, pct),color = zipcode)) +
geom_point(stat = "identity", size = 5) +
geom_text_repel(aes(label = lbl), size = 6, color = "gray30", segment.alpha = 0, family = "foo", nudge_y = .3, nudge_x = .01) +
scale_x_continuous(label = scales::percent) +
scale_color_manual(values = wes_palette("Darjeeling2", n = 3)) +
guides(color = guide_legend(label.position = "left", label.vjust = 0.5, label.hjust = 1)) +
labs(y = NULL, x = NULL, color = NULL,
title = "Figure 3. Employment Status: Retired by race and ethnicity",
subtitle = str_wrap("In the last seven days, what is your employment status?"),
caption = "Source: 2021 San Antonio Energy and Time Use Survey") +
theme_classic() +
themeuf### Task Three: Other SES
### frontline worker
frontline <- NULL
total <- NULL
frontline_pct <- NULL
total <- data %>%
group_by(zipcode, race_eth2) %>%
summarize(n = n(),na.rm = TRUE)
frontline <- data %>%
filter(frontline == "Yes") %>%
group_by(zipcode, race_eth2) %>%
summarize(frontline_n = n())
frontline_pct <- data.frame(total[,"zipcode"],total[,"race_eth2"],total[,"n"],frontline[,"frontline_n"])
frontline_pct <- frontline_pct %>%
mutate(pct = frontline_n/n,
lbl = scales::percent(pct, accuracy = 0.1))
frontline_pct %>%
ggplot(aes(x = pct, y = reorder(race_eth2, pct),color = zipcode)) +
geom_point(stat = "identity", size = 5) +
geom_text_repel(aes(label = lbl), size = 6, color = "gray30", segment.alpha = 0, family = "foo", nudge_y = .3, nudge_x = .01) +
scale_x_continuous(label = scales::percent) +
scale_color_manual(values = wes_palette("Darjeeling2", n = 3)) +
guides(color = guide_legend(label.position = "left", label.vjust = 0.5, label.hjust = 1)) +
labs(y = NULL, x = NULL, color = NULL,
title = "Figure 1. Frontline worker by race and ethnicity",
subtitle = str_wrap("Are you a frontline worker?"),
caption = "Source: 2021 San Antonio Energy and Time Use Survey") +
theme_classic() +
themeuf### average hrs_work
hrs_work <- data %>%
filter(hrs_work_3 != "NA") %>%
group_by(zipcode, race_eth2) %>%
summarize(average_hrs = mean(hrs_work_3))
hrs_work %>%
ggplot(aes(x = average_hrs, y = reorder(race_eth2,average_hrs ),color = zipcode)) +
geom_point(stat = "identity", size = 5) +
geom_text_repel(aes(label = round(average_hrs,2)), size = 6, color = "gray30", segment.alpha = 0, family = "foo", nudge_y = .3, nudge_x = .01) +
scale_x_continuous(limits = c(30,45)) +
scale_color_manual(values = wes_palette("Darjeeling2", n = 3)) +
guides(color = guide_legend(label.position = "left", label.vjust = 0.5, label.hjust = 1)) +
labs(y = NULL, x = NULL, color = NULL,
title = "Figure 2. Average Working Hours by race and ethnicity",
subtitle = str_wrap("How many hours per week do you usually work?"),
caption = "Source: 2021 San Antonio Energy and Time Use Survey") +
theme_classic() +
themeuf### welfare_1
asian <- NULL
total_1 <- data[!is.na(data$welfare_1),]
total_1 <- total_1 %>%
group_by(zipcode, race_eth2) %>%
summarize(n = n())
zipcode <- "Jefferson Heights"
race_eth2 <- "Non-Hispanic Asian"
welfare_1 <- 0
asian <- data.frame(zipcode,race_eth2,welfare_1)
welfare_1 <- data %>%
filter(welfare_1 == "Yes") %>%
group_by(zipcode, race_eth2) %>%
summarize(welfare_1 = n())
welfare_1 <- data.frame(welfare_1)
welfare_1 <- rbind(welfare_1,asian)
welfare_1 <- welfare_1[with(welfare_1,order(zipcode,race_eth2)),]
welfare_1_pct <- data.frame(total_1[,"zipcode"],total_1[,"race_eth2"],total_1[,"n"],welfare_1[,"welfare_1"])
colnames(welfare_1_pct) <- c("zipcode","race_eth2","n","welfare_1")
welfare_1_pct <- welfare_1_pct %>%
mutate(pct = welfare_1/n,
lbl = scales::percent(pct, accuracy = 0.1))
welfare_1_pct %>%
ggplot(aes(x = pct, y = reorder(race_eth2,pct),color = zipcode)) +
geom_point(stat = "identity", size = 5) +
geom_text_repel(aes(label = lbl), size = 6, color = "gray30", segment.alpha = 0, family = "foo", nudge_y = .3, nudge_x = .01) +
scale_x_continuous(label = scales::percent) +
scale_color_manual(values = wes_palette("Darjeeling2", n = 3)) +
guides(color = guide_legend(label.position = "left", label.vjust = 0.5, label.hjust = 1)) +
labs(y = NULL, x = NULL, color = NULL,
title = "Figure 4. % of Welfare_1 (Unemployment Insurance) by race and ethnicity",
subtitle = str_wrap("Have you, or has anyone in your household received any of the following:"),
caption = "Source: 2021 San Antonio Energy and Time Use Survey") +
theme_classic() +
themeuf### welfare_2
total_2 <- NULL
total_2 <- data[!is.na(data$welfare_2),]
total_2 <- total_2 %>%
group_by(zipcode, race_eth2) %>%
summarize(n = n())
welfare_2 <- data %>%
filter(welfare_2 == "Yes") %>%
group_by(zipcode, race_eth2) %>%
summarize(welfare_2 = n())
welfare_2_pct <- data.frame(total_1[,"zipcode"],total_1[,"race_eth2"],total_1[,"n"],welfare_2[,"welfare_2"])
welfare_2_pct <- welfare_2_pct %>%
mutate(pct = welfare_2/n,
lbl = scales::percent(pct, accuracy = 0.1))
welfare_2_pct %>%
ggplot(aes(x = pct, y = reorder(race_eth2,pct),color = zipcode)) +
geom_point(stat = "identity", size = 5) +
geom_text_repel(aes(label = lbl), size = 6, color = "gray30", segment.alpha = 0, family = "foo", nudge_y = .3, nudge_x = .01) +
scale_x_continuous(label = scales::percent) +
scale_color_manual(values = wes_palette("Darjeeling2", n = 3)) +
guides(color = guide_legend(label.position = "left", label.vjust = 0.5, label.hjust = 1)) +
labs(y = NULL, x = NULL, color = NULL,
title = "Figure 5. % of Welfare_2 (Social Security benefits) by race and ethnicity",
subtitle = str_wrap("Have you, or has anyone in your household received any of the following:"),
caption = "Source: 2021 San Antonio Energy and Time Use Survey") +
theme_classic() +
themeuf### welfare_3
total_3 <- NULL
total_3 <- data[!is.na(data$welfare_3),]
total_3 <- total_3 %>%
group_by(zipcode, race_eth2) %>%
summarize(n = n())
zipcode <- c("Elm Creek","Jefferson Heights")
race_eth2 <- c("Non-Hispanic Asian","Non-Hispanic Other")
welfare_3 <- c(0,0)
zero <- data.frame(zipcode, race_eth2, welfare_3)
welfare_3 <- data %>%
filter(welfare_3 == "Yes") %>%
group_by(zipcode, race_eth2) %>%
summarize(welfare_3 = n())
welfare_3 <- data.frame(welfare_3)
welfare_3 <- rbind(welfare_3,zero)
welfare_3 <- welfare_3[with(welfare_3,order(zipcode,race_eth2)),]
welfare_3_pct <- data.frame(total_3[,"zipcode"],total_3[,"race_eth2"],total_3[,"n"],welfare_3[,"welfare_3"])
colnames(welfare_3_pct) <- c("zipcode","race_eth2","n","welfare_3")
welfare_3_pct <- welfare_3_pct %>%
mutate(pct = welfare_3/n,
lbl = scales::percent(pct, accuracy = 0.1))
welfare_3_pct %>%
ggplot(aes(x = pct, y = reorder(race_eth2,pct),color = zipcode)) +
geom_point(stat = "identity", size = 5) +
geom_text_repel(aes(label = lbl), size = 6, color = "gray30", segment.alpha = 0, family = "foo", nudge_y = .3, nudge_x = .01) +
scale_x_continuous(label = scales::percent) +
scale_color_manual(values = wes_palette("Darjeeling2", n = 3)) +
guides(color = guide_legend(label.position = "left", label.vjust = 0.5, label.hjust = 1)) +
labs(y = NULL, x = NULL, color = NULL,
title = "Figure 6. % of Welfare_3 (Supplemental Security Income (SSI)) by race and ethnicity",
subtitle = str_wrap("Have you, or has anyone in your household received any of the following:"),
caption = "Source: 2021 San Antonio Energy and Time Use Survey") +
theme_classic() +
themeuf### welfare_4
total_4 <- NULL
total_4 <- data[!is.na(data$welfare_4),]
total_4 <- total_4 %>%
group_by(zipcode, race_eth2) %>%
summarize(n = n())
zipcode <- "Jefferson Heights"
race_eth2 <- "Non-Hispanic Asian"
welfare_4 <- 0
zero <- data.frame(zipcode, race_eth2, welfare_4)
welfare_4 <- data %>%
filter(welfare_4 == "Yes") %>%
group_by(zipcode, race_eth2) %>%
summarize(welfare_4 = n())
welfare_4 <- data.frame(welfare_4)
welfare_4 <- rbind(welfare_4,zero)
welfare_4 <- welfare_4[with(welfare_4,order(zipcode,race_eth2)),]
welfare_4_pct <- data.frame(total_4[,"zipcode"],total_4[,"race_eth2"],total_4[,"n"],welfare_4[,"welfare_4"])
colnames(welfare_4_pct) <- c("zipcode","race_eth2","n","welfare_4")
welfare_4_pct <- welfare_4_pct %>%
mutate(pct = welfare_4/n,
lbl = scales::percent(pct, accuracy = 0.1))
welfare_4_pct %>%
ggplot(aes(x = pct, y = reorder(race_eth2,pct),color = zipcode)) +
geom_point(stat = "identity", size = 5) +
geom_text_repel(aes(label = lbl), size = 6, color = "gray30", segment.alpha = 0, family = "foo", nudge_y = .3, nudge_x = .01) +
scale_x_continuous(label = scales::percent) +
scale_color_manual(values = wes_palette("Darjeeling2", n = 3)) +
guides(color = guide_legend(label.position = "left", label.vjust = 0.5, label.hjust = 1)) +
labs(y = NULL, x = NULL, color = NULL,
title = "Figure 7. % of Welfare_4 Medicare benefits by race and ethnicity",
subtitle = str_wrap("Have you, or has anyone in your household received any of the following:"),
caption = "Source: 2021 San Antonio Energy and Time Use Survey") +
theme_classic() +
themeuf### welfare_5
total_5 <- NULL
total_5 <- data[!is.na(data$welfare_5),]
total_5 <- total_5 %>%
group_by(zipcode, race_eth2) %>%
summarize(n = n())
zipcode <- "Jefferson Heights"
race_eth2 <- "Non-Hispanic Asian"
welfare_5 <- 0
zero <- data.frame(zipcode, race_eth2, welfare_5)
welfare_5 <- data %>%
filter(welfare_5 == "Yes") %>%
group_by(zipcode, race_eth2) %>%
summarize(welfare_5 = n())
welfare_5 <- data.frame(welfare_5)
welfare_5 <- rbind(welfare_5,zero)
welfare_5 <- welfare_5[with(welfare_5,order(zipcode,race_eth2)),]
welfare_5_pct <- data.frame(total_5[,"zipcode"],total_5[,"race_eth2"],total_5[,"n"],welfare_5[,"welfare_5"])
colnames(welfare_5_pct) <- c("zipcode","race_eth2","n","welfare_5")
welfare_5_pct <- welfare_5_pct %>%
mutate(pct = welfare_5/n,
lbl = scales::percent(pct, accuracy = 0.1))
welfare_5_pct %>%
ggplot(aes(x = pct, y = reorder(race_eth2,pct),color = zipcode)) +
geom_point(stat = "identity", size = 5) +
geom_text_repel(aes(label = lbl), size = 6, color = "gray30", segment.alpha = 0, family = "foo", nudge_y = .3, nudge_x = .01) +
scale_x_continuous(label = scales::percent) +
scale_color_manual(values = wes_palette("Darjeeling2", n = 3)) +
guides(color = guide_legend(label.position = "left", label.vjust = 0.5, label.hjust = 1)) +
labs(y = NULL, x = NULL, color = NULL,
title = "Figure 8. % of Welfare_5 Stimulus (economic impact) Payment by race and ethnicity",
subtitle = str_wrap("Have you, or has anyone in your household received any of the following:"),
caption = "Source: 2021 San Antonio Energy and Time Use Survey") +
theme_classic() +
themeuf### welfare_6
total_6 <- NULL
total_6 <- data[!is.na(data$welfare_6),]
total_6 <- total_6 %>%
group_by(zipcode, race_eth2) %>%
summarize(n = n())
zipcode <- c("Jefferson Heights","Elm Creek")
race_eth2 <- c("Non-Hispanic Asian","Non-Hispanic Asian")
welfare_6 <- c(0,0)
zero <- data.frame(zipcode, race_eth2, welfare_6)
welfare_6 <- data %>%
filter(welfare_6 == "Yes") %>%
group_by(zipcode, race_eth2) %>%
summarize(welfare_6 = n())
welfare_6 <- data.frame(welfare_6)
welfare_6 <- rbind(welfare_6,zero)
welfare_6 <- welfare_6[with(welfare_6,order(zipcode,race_eth2)),]
welfare_6_pct <- data.frame(total_6[,"zipcode"],total_6[,"race_eth2"],total_6[,"n"],welfare_6[,"welfare_6"])
colnames(welfare_6_pct) <- c("zipcode","race_eth2","n","welfare_6")
welfare_6_pct <- welfare_6_pct %>%
mutate(pct = welfare_6/n,
lbl = scales::percent(pct, accuracy = 0.1))
welfare_6_pct %>%
ggplot(aes(x = pct, y = reorder(race_eth2,pct),color = zipcode)) +
geom_point(stat = "identity", size = 5) +
geom_text_repel(aes(label = lbl), size = 6, color = "gray30", segment.alpha = 0, family = "foo", nudge_y = .3, nudge_x = .01) +
scale_x_continuous(label = scales::percent) +
scale_color_manual(values = wes_palette("Darjeeling2", n = 3)) +
guides(color = guide_legend(label.position = "left", label.vjust = 0.5, label.hjust = 1)) +
labs(y = NULL, x = NULL, color = NULL,
title = "Figure 9. % of Welfare_6 Supplemental Nutrition Assistance Program (SNAP) by race and ethnicity",
subtitle = str_wrap("Have you, or has anyone in your household received any of the following:"),
caption = "Source: 2021 San Antonio Energy and Time Use Survey") +
theme_classic() +
themeuf### welfare_7
total_7 <- NULL
total_7 <- data[!is.na(data$welfare_7),]
total_7 <- total_7 %>%
group_by(zipcode, race_eth2) %>%
summarize(n = n())
welfare_7 <- data %>%
filter(welfare_7 == "Yes") %>%
group_by(zipcode, race_eth2) %>%
summarize(welfare_7 = n())
welfare_7_pct <- data.frame(total_7[,"zipcode"],total_7[,"race_eth2"],total_7[,"n"],welfare_7[,"welfare_7"])
colnames(welfare_7_pct) <- c("zipcode","race_eth2","n","welfare_7")
welfare_7_pct <- welfare_7_pct %>%
mutate(pct = welfare_7/n,
lbl = scales::percent(pct, accuracy = 0.1))
welfare_7_pct %>%
ggplot(aes(x = pct, y = reorder(race_eth2,pct),color = zipcode)) +
geom_point(stat = "identity", size = 5) +
geom_text_repel(aes(label = lbl), size = 6, color = "gray30", segment.alpha = 0, family = "foo", nudge_y = .3, nudge_x = .01) +
scale_x_continuous(label = scales::percent) +
scale_color_manual(values = wes_palette("Darjeeling2", n = 3)) +
guides(color = guide_legend(label.position = "left", label.vjust = 0.5, label.hjust = 1)) +
labs(y = NULL, x = NULL, color = NULL,
title = "Figure 10. % of Welfare_7 Other types of need-based assistance from the city or federal government by race and ethnicity",
subtitle = str_wrap("Have you, or has anyone in your household received any of the following:"),
caption = "Source: 2021 San Antonio Energy and Time Use Survey") +
theme_classic() +
themeufloss.1 %>%
ggplot(aes(x = pct, y = reorder(hardships, pct), color = zipcode)) +
geom_point(stat = "identity", aes(size = n)) +
geom_text_repel(aes(label = lbl), size = 6.5, color = "gray30", segment.alpha = 0, family = "foo", nudge_x = .03, nudge_y = .2) +
scale_x_continuous(limits = c(0, 1), breaks = seq(0, 1, .15), label = scales::percent) +
scale_color_manual(values = wes_palette("Darjeeling2", n = 3)) +
guides(color = guide_legend(label.position = "left", label.vjust = 0.5, label.hjust = 1, override.aes = list(size = 5)), size = F) +
labs(y = NULL, x = NULL, color = NULL,
title = "Loss of employment by zip code",
subtitle = str_wrap("Since the onset of COVID-19 (March 2020), has anyone in this household experienced the loss of employment income"),
caption = "Source: 2021 San Antonio Energy and Time Use Survey") +
theme_classic() +
themeufloss.2 %>%
ggplot(aes(x = pct, y = reorder(hardships, pct), color = zipcode)) +
geom_point(stat = "identity", aes(size = n)) +
geom_text_repel(aes(label = lbl), size = 6.5, color = "gray30", segment.alpha = 0, family = "foo", nudge_x = .03, nudge_y = .2) +
scale_x_continuous(limits = c(0, 1), breaks = seq(0, 1, .15), label = scales::percent) +
scale_color_manual(values = wes_palette("Darjeeling2", n = 3)) +
guides(color = guide_legend(label.position = "left", label.vjust = 0.5, label.hjust = 1, override.aes = list(size = 5)), size = F) +
labs(y = NULL, x = NULL, color = NULL,
title = "Difficulty in paying utility bills by zip code",
subtitle = str_wrap("Since the onset of COVID-19 (March 2020), has anyone in this household experienced difficulties their paying utility bills"),
caption = "Source: 2021 San Antonio Energy and Time Use Survey") +
theme_classic() +
themeufloss.3 %>%
ggplot(aes(x = pct, y = reorder(hardships, pct), color = zipcode)) +
geom_point(stat = "identity", aes(size = n)) +
geom_text_repel(aes(label = lbl), size = 6.5, color = "gray30", segment.alpha = 0, family = "foo", nudge_x = .03, nudge_y = .2) +
scale_x_continuous(limits = c(0, 1), breaks = seq(0, 1, .15), label = scales::percent) +
scale_color_manual(values = wes_palette("Darjeeling2", n = 3)) +
guides(color = guide_legend(label.position = "left", label.vjust = 0.5, label.hjust = 1, override.aes = list(size = 5)), size = F) +
labs(y = NULL, x = NULL, color = NULL,
title = "Difficulty in affording the food you need by zip code",
subtitle = str_wrap("Since the onset of COVID-19 (March 2020), has anyone in this household experienced difficulties affording the food you need"),
caption = "Source: 2021 San Antonio Energy and Time Use Survey") +
theme_classic() +
themeufloss.4 %>%
ggplot(aes(x = pct, y = reorder(hardships, pct), color = zipcode)) +
geom_point(stat = "identity", aes(size = n)) +
geom_text_repel(aes(label = lbl), size = 6.5, color = "gray30", segment.alpha = 0, family = "foo", nudge_x = .03, nudge_y = .2) +
scale_x_continuous(limits = c(0, 1), breaks = seq(0, 1, .15), label = scales::percent) +
scale_color_manual(values = wes_palette("Darjeeling2", n = 3)) +
guides(color = guide_legend(label.position = "left", label.vjust = 0.5, label.hjust = 1, override.aes = list(size = 5)), size = F) +
labs(y = NULL, x = NULL, color = NULL,
title = "Difficulty in paying rent or mortgage by zip code",
subtitle = str_wrap("Since the onset of COVID-19 (March 2020), has anyone in this household experienced difficulties paying rent or mortgage"),
caption = "Source: 2021 San Antonio Energy and Time Use Survey") +
theme_classic() +
themeufloss.5 %>%
ggplot(aes(x = pct, y = reorder(hardships, pct), color = zipcode)) +
geom_point(stat = "identity", aes(size = n)) +
geom_text_repel(aes(label = lbl), size = 6.5, color = "gray30", segment.alpha = 0, family = "foo", nudge_x = .03, nudge_y = .2) +
scale_x_continuous(limits = c(0, 1), breaks = seq(0, 1, .15), label = scales::percent) +
scale_color_manual(values = wes_palette("Darjeeling2", n = 3)) +
guides(color = guide_legend(label.position = "left", label.vjust = 0.5, label.hjust = 1, override.aes = list(size = 5)), size = F) +
labs(y = NULL, x = NULL, color = NULL,
title = "Difficulty in paying medical bill/health insurance by zip code",
subtitle = str_wrap("Since the onset of COVID-19 (March 2020), has anyone in this household experienced difficulties paying medical bills"),
caption = "Source: 2021 San Antonio Energy and Time Use Survey") +
theme_classic() +
themeufloss.6 %>%
ggplot(aes(x = pct, y = reorder(hardships, pct), color = zipcode)) +
geom_point(stat = "identity", aes(size = n)) +
geom_text_repel(aes(label = lbl), size = 6.5, color = "gray30", segment.alpha = 0, family = "foo", nudge_x = .03, nudge_y = .2) +
scale_x_continuous(limits = c(0, 1), breaks = seq(0, 1, .15), label = scales::percent) +
scale_color_manual(values = wes_palette("Darjeeling2", n = 3)) +
guides(color = guide_legend(label.position = "left", label.vjust = 0.5, label.hjust = 1, override.aes = list(size = 5)), size = F) +
labs(y = NULL, x = NULL, color = NULL,
title = "Delay getting medical care or medication by zip code",
subtitle = str_wrap("Since the onset of COVID-19 (March 2020), has anyone in this household experienced delay getting medical care or prescription medication"),
caption = "Source: 2021 San Antonio Energy and Time Use Survey") +
theme_classic() +
themeufhardships %>%
filter(hardships != "No difficulty") %>%
ggplot(aes(x = pct, y = reorder(hardships, pct), color = zipcode)) +
geom_point(stat = "identity", aes(size = n)) +
geom_text_repel(aes(label = lbl), size = 6, color = "gray30", segment.alpha = 0, family = "foo", nudge_y = .2, nudge_x = .03) +
scale_x_continuous(limits = c(0, .75), breaks = seq(0, 1, .15), label = scales::percent) +
scale_color_manual(values = wes_palette("Darjeeling2", n = 3)) +
guides(color = guide_legend(label.position = "left", label.vjust = 0.5, label.hjust = 1, override.aes = list(size = 5)), size = F) +
labs(y = NULL, x = NULL, color = NULL,
title = "Type of hardship experienced by zip code",
subtitle = str_wrap("Since the onset of COVID-19 (March 2020), have you, or has anyone in your household experienced any of the following hardships"),
caption = "Source: 2021 San Antonio Energy and Time Use Survey") +
theme_classic() +
themeufdata %>%
filter(!is.na(bad)) %>%
group_by(zipcode, bad) %>%
summarize(n = n()) %>%
mutate(pct = n/sum(n),
lbl = scales::percent(pct, accuracy = 0.1)) %>%
ggplot(aes(x = pct, y = reorder(bad, pct), color = zipcode)) +
geom_point(stat = "identity", aes(size = n)) +
geom_text_repel(aes(label = lbl), size = 6.5, color = "gray30", segment.alpha = 0, family = "foo", nudge_y = .2, nudge_x = .03) +
scale_x_continuous(limits = c(0, .7), breaks = seq(0, 1, .15), label = scales::percent) +
scale_color_manual(values = wes_palette("Darjeeling2", n = 3)) +
guides(color = guide_legend(label.position = "left", label.vjust = 0.5, label.hjust = 1, override.aes = list(size = 5)), size = F) +
labs(y = NULL, x = NULL, color = NULL,
title = "Number of hardships by zip code",
subtitle = str_wrap("Since the onset of COVID-19 (March 2020), have you, or has anyone in your household experienced any type of hardships"),
caption = "Source: 2021 San Antonio Energy and Time Use Survey") +
theme_classic() +
themeufloss.1r %>%
ggplot(aes(x = pct, y = reorder(race_eth2, pct), color = hardships)) +
geom_point(stat = "identity", aes(size = n)) +
geom_text_repel(aes(label = lbl), size = 6, color = "gray30", segment.alpha = 0, family = "foo", nudge_y = .2, nudge_x = .03) +
scale_x_continuous(limits = c(0, .60), breaks = seq(0, 1, .15), label = scales::percent) +
scale_color_manual(values = wes_palette("Darjeeling2", n = 5)) +
guides(color = guide_legend(label.position = "left", label.vjust = 0.5, label.hjust = 1, override.aes = list(size = 5), reverse = T),
size = F) +
facet_grid(~zipcode) +
labs(y = NULL, x = NULL, color = NULL,
title = "Loss of employment by zip code",
subtitle = str_wrap("Since the onset of COVID-19 (March 2020), has anyone in this household experienced the loss of employment income"),
caption = "Source: 2021 San Antonio Energy and Time Use Survey") +
theme_classic() +
themeufloss.2r %>%
ggplot(aes(x = pct, y = reorder(race_eth2, pct), color = hardships)) +
geom_point(stat = "identity", aes(size = n)) +
geom_text_repel(aes(label = lbl), size = 6, color = "gray30", segment.alpha = 0, family = "foo", nudge_y = .2, nudge_x = .03) +
scale_x_continuous(limits = c(0, .60), breaks = seq(0, 1, .15), label = scales::percent) +
scale_color_manual(values = wes_palette("Darjeeling2", n = 5)) +
guides(color = guide_legend(label.position = "left", label.vjust = 0.5, label.hjust = 1, override.aes = list(size = 5), reverse = T),
size = F) +
facet_grid(~zipcode) +
labs(y = NULL, x = NULL, color = NULL,
title = "Difficulty in paying utility bills by zip code",
subtitle = str_wrap("Since the onset of COVID-19 (March 2020), has anyone in this household experienced difficulties their paying utility bills"),
caption = "Source: 2021 San Antonio Energy and Time Use Survey") +
theme_classic() +
themeufloss.3r %>%
ggplot(aes(x = pct, y = reorder(race_eth2, pct), color = hardships)) +
geom_point(stat = "identity", aes(size = n)) +
geom_text_repel(aes(label = lbl), size = 6, color = "gray30", segment.alpha = 0, family = "foo", nudge_y = .2, nudge_x = .03) +
scale_x_continuous(limits = c(0, .60), breaks = seq(0, 1, .15), label = scales::percent) +
scale_color_manual(values = wes_palette("Darjeeling2", n = 5)) +
guides(color = guide_legend(label.position = "left", label.vjust = 0.5, label.hjust = 1, override.aes = list(size = 5), reverse = T),
size = F) +
facet_grid(~zipcode) +
labs(y = NULL, x = NULL, color = NULL,
title = "Difficulty in affording the food you need by zip code",
subtitle = str_wrap("Since the onset of COVID-19 (March 2020), has anyone in this household experienced difficulties affording the food you need"),
caption = "Source: 2021 San Antonio Energy and Time Use Survey") +
theme_classic() +
themeufloss.4r %>%
ggplot(aes(x = pct, y = reorder(race_eth2, pct), color = hardships)) +
geom_point(stat = "identity", aes(size = n)) +
geom_text_repel(aes(label = lbl), size = 6, color = "gray30", segment.alpha = 0, family = "foo", nudge_y = .2, nudge_x = .03) +
scale_x_continuous(limits = c(0, .60), breaks = seq(0, 1, .15), label = scales::percent) +
scale_color_manual(values = wes_palette("Darjeeling2", n = 5)) +
guides(color = guide_legend(label.position = "left", label.vjust = 0.5, label.hjust = 1, override.aes = list(size = 5), reverse = T),
size = F) +
facet_grid(~zipcode) +
labs(y = NULL, x = NULL, color = NULL,
title = "Difficulty in paying rent or mortgage by zip code",
subtitle = str_wrap("Since the onset of COVID-19 (March 2020), has anyone in this household experienced difficulties paying rent or mortgage"),
caption = "Source: 2021 San Antonio Energy and Time Use Survey") +
theme_classic() +
themeufloss.5r %>%
ggplot(aes(x = pct, y = reorder(race_eth2, pct), color = hardships)) +
geom_point(stat = "identity", aes(size = n)) +
geom_text_repel(aes(label = lbl), size = 6, color = "gray30", segment.alpha = 0, family = "foo", nudge_y = .2, nudge_x = .03) +
scale_x_continuous(limits = c(0, .60), breaks = seq(0, 1, .15), label = scales::percent) +
scale_color_manual(values = wes_palette("Darjeeling2", n = 5)) +
guides(color = guide_legend(label.position = "left", label.vjust = 0.5, label.hjust = 1, override.aes = list(size = 5), reverse = T),
size = F) +
facet_grid(~zipcode) +
labs(y = NULL, x = NULL, color = NULL,
title = "Difficulty in paying medical bill/health insurance by zip code",
subtitle = str_wrap("Since the onset of COVID-19 (March 2020), has anyone in this household experienced difficulties paying medical bills"),
caption = "Source: 2021 San Antonio Energy and Time Use Survey") +
theme_classic() +
themeufloss.6r %>%
ggplot(aes(x = pct, y = reorder(race_eth2, pct), color = hardships)) +
geom_point(stat = "identity", aes(size = n)) +
geom_text_repel(aes(label = lbl), size = 6, color = "gray30", segment.alpha = 0, family = "foo", nudge_y = .2, nudge_x = .03) +
scale_x_continuous(limits = c(0, .60), breaks = seq(0, 1, .15), label = scales::percent) +
scale_color_manual(values = wes_palette("Darjeeling2", n = 5)) +
guides(color = guide_legend(label.position = "left", label.vjust = 0.5, label.hjust = 1, override.aes = list(size = 5), reverse = T),
size = F) +
facet_grid(~zipcode) +
labs(y = NULL, x = NULL, color = NULL,
title = "Delay getting medical care or medication by zip code",
subtitle = str_wrap("Since the onset of COVID-19 (March 2020), has anyone in this household experienced delay getting medical care or prescription medication"),
caption = "Source: 2021 San Antonio Energy and Time Use Survey") +
theme_classic() +
themeufhardships.r %>%
filter(hardships != "No difficulty") %>%
ggplot(aes(x = pct, y = reorder(hardships, -pct), color = race_eth2)) +
geom_point(stat = "identity", aes(size = n)) +
geom_text_repel(aes(label = lbl), size = 4.5, color = "gray30", segment.alpha = 0, family = "foo", nudge_y = .25, nudge_x = .025) +
scale_x_continuous(limits = c(0, .65), breaks = seq(0, 1, .15), label = scales::percent) +
scale_color_manual(values = wes_palette("Zissou1", n = 5)) +
guides(color = guide_legend(label.position = "left", label.vjust = 0.5, label.hjust = 1, override.aes = list(size = 4), reverse = F, byrow = T, ncol = 3),
size = F) +
facet_grid(~zipcode) +
labs(y = NULL, x = NULL, color = NULL,
title = "Type of hardship experienced by race and ethnicity",
subtitle = str_wrap("Since the onset of COVID-19 (March 2020), have you, or has anyone in your household experienced any of the following hardships"),
caption = "Source: 2021 San Antonio Energy and Time Use Survey") +
theme_classic() +
themeuf + theme(legend.position = "bottom")data %>%
filter(!is.na(bad)) %>%
group_by(zipcode, race_eth2, bad) %>%
summarize(n = n()) %>%
mutate(pct = n/sum(n),
lbl = scales::percent(pct, accuracy = 0.1)) %>%
ggplot(aes(x = pct, y = reorder(race_eth2, -pct), color = zipcode)) +
geom_point(stat = "identity", aes(size = n)) +
geom_text_repel(aes(label = lbl), size = 5, color = "gray30", segment.alpha = 0, family = "foo", nudge_y = .2, nudge_x = .01) +
scale_x_continuous(limits = c(0, .75), breaks = seq(0, 1, .15), label = scales::percent) +
scale_color_manual(values = wes_palette("Darjeeling2", n = 3)) +
guides(color = guide_legend(label.position = "left", label.vjust = 0.5, label.hjust = 1, override.aes = list(size = 5)), size = F) +
facet_grid(~bad) +
labs(y = NULL, x = NULL, color = NULL,
title = "Number of hardships by zip code",
subtitle = str_wrap("Since the onset of COVID-19 (March 2020), have you, or has anyone in your household experienced any type of hardships"),
caption = "Source: 2021 San Antonio Energy and Time Use Survey") +
theme_classic() +
themeuf + theme(axis.text.x = element_text(color = "gray40", size = 18))data %>%
group_by(zipcode, health) %>%
summarize(n = n()) %>%
mutate(pct = n/sum(n),
lbl = scales::percent(pct, accuracy = 0.1)) %>%
ggplot(aes(x = pct, y = health, color = zipcode)) +
geom_point(stat = "identity", aes(size = n)) +
geom_text_repel(aes(label = lbl), size = 5.5, color = "gray30", segment.alpha = 0, family = "foo", nudge_y = .2, nudge_x = .02) +
scale_x_continuous(limits = c(0, .5), breaks = seq(0, 1, .15), label = scales::percent) +
scale_y_discrete(limits = rev(levels(data$health))) +
scale_color_manual(values = wes_palette("Darjeeling2", n = 3)) +
guides(color = guide_legend(label.position = "left", label.vjust = 0.5, label.hjust = 1, override.aes = list(size = 5)), size = F) +
labs(y = NULL, x = NULL, color = NULL,
title = "Self-rated health status by race and ethnicity",
subtitle = str_wrap("Since the onset of COVID-19 (March 2020), has anyone in this household experienced the loss of employment income"),
caption = "Source: 2021 San Antonio Energy and Time Use Survey") +
theme_classic() +
themeufdata %>%
group_by(zipcode, race_eth2, health) %>%
summarize(n = n()) %>%
mutate(pct = n/sum(n),
lbl = scales::percent(pct, accuracy = 0.1)) %>%
ggplot(aes(x = pct, y = race_eth2, color = health)) +
geom_point(stat = "identity", aes(size = n)) +
geom_text_repel(aes(label = lbl), size = 4.5, color = "gray30", segment.alpha = 0, family = "foo", nudge_y = .2, nudge_x = .015) +
scale_x_continuous(limits = c(0, .9), breaks = seq(0, 1, .15), label = scales::percent) +
scale_y_discrete(limits = rev(levels(data$race_eth2))) +
scale_color_manual(values = wes_palette("Zissou1", n = 5)) +
guides(color = guide_legend(label.position = "left", label.vjust = 0.5, label.hjust = 1, override.aes = list(size = 5)), size = F) +
facet_grid(~zipcode) +
labs(y = NULL, x = NULL, color = NULL,
title = "Self-rated health status by race and ethnicity",
subtitle = str_wrap("Since the onset of COVID-19 (March 2020), has anyone in this household experienced the loss of employment income"),
caption = "Source: 2021 San Antonio Energy and Time Use Survey") +
theme_classic() +
themeufdata %>%
group_by(zipcode) %>%
summarize(ph.mean = round(mean(physical_health), 1),
mh.mean = round(mean(mental_health), 1),
n = n()) %>%
mutate(label = ph.mean,
label2 = mh.mean) %>%
ggplot(aes(y = zipcode, color = zipcode, group = zipcode)) +
geom_point(aes(x = ph.mean), shape = 19, size = 5, show.legend = T) +
geom_point(aes(x = mh.mean), shape = 18, size = 5, show.legend = T) +
geom_text_repel(aes(label = label, x = ph.mean), size = 7, color = "gray30", nudge_y = .2, segment.alpha = 0, family = "foo") +
geom_text_repel(aes(label = label2, x = mh.mean), size = 7, color = "gray30", nudge_y = .2, segment.alpha = 0, family = "foo") +
annotate("text", x = 2, y = 1, label = "Physical health", color = "gray40", size = 8, hjust = "right") +
annotate("text", x = 5, y = 2, label = "Mental health", color = "gray40", size = 8, hjust = "left") +
annotate("curve", x = 2, xend = 3.05, y = .95, yend = 1, colour = "gray60",
arrow=arrow(type = "open", length = unit(3, "mm")), curvature = .25, hjust = "upper") +
annotate("curve", x = 5, xend = 3.8, y = 2.05, yend = 2, colour = "gray60",
arrow=arrow(type = "open", length = unit(3, "mm")), curvature = .25, hjust = "upper") +
scale_color_manual(values = wes_palette("Darjeeling2", n = 3)) +
scale_x_continuous(limits = c(1, 6), breaks = seq(0, 6, 1)) +
scale_y_discrete(limits = rev(levels(data$zipcode))) +
guides(color = guide_legend(label.position = "left", label.vjust = 0.5, label.hjust = 1, override.aes = list(size = 5), reverse = T),
size = FALSE) +
labs(y = NULL,
color = NULL,
x = "Number of days",
title = str_wrap("For how many days during the past 30 days was your physical health not good?", width = 50),
subtitle = str_wrap("We show the average number of days without good physical health by race and ethnicity", width = 65),
caption = "Source: 2021 San Antonio Energy and Time Use Survey") +
theme_classic() +
themeufdata %>%
group_by(zipcode, race_eth2) %>%
summarize(ph.mean = round(mean(physical_health), 1),
mh.mean = round(mean(mental_health), 1),
n = n()) %>%
mutate(label = ph.mean) %>%
ggplot(aes(x = ph.mean, y = race_eth2)) +
geom_point(aes(color = zipcode, size = n), shape = 19) +
geom_text_repel(aes(label = label, x = ph.mean), size = 6, color = "gray30", nudge_y = .31, segment.alpha = 0, family = "foo") +
scale_color_manual(values = wes_palette("Darjeeling2", n = 3)) +
scale_x_continuous(limits = c(0, 5), breaks = seq(0, 5, 1)) +
scale_y_discrete(limits = rev(levels(data$race_eth2))) +
guides(color = guide_legend(label.position = "left", label.vjust = 0.5, label.hjust = 1, override.aes = list(size = 5)),
size = FALSE) +
labs(y = NULL,
color = NULL,
x = "Number of days",
title = str_wrap("For how many days during the past 30 days was your physical health not good?", width = 50),
subtitle = str_wrap("We show the average number of days without good physical health by race and ethnicity", width = 65),
caption = "Source: 2021 San Antonio Energy and Time Use Survey") +
theme_classic() +
themeufdata %>%
group_by(zipcode, race_eth2) %>%
summarize(ph.mean = round(mean(physical_health), 1),
mh.mean = round(mean(mental_health), 1),
n = n()) %>%
mutate(label = mh.mean) %>%
ggplot(aes(x =mh.mean, y = race_eth2)) +
geom_point(aes(color = zipcode, size = n), shape = 19) +
geom_text_repel(aes(label = label, x = mh.mean), size = 6, color = "gray30", nudge_y = .31, segment.alpha = 0, family = "foo") +
scale_color_manual(values = wes_palette("Darjeeling2", n = 3)) +
scale_x_continuous(limits = c(0, 7), breaks = seq(0, 5, 1)) +
scale_y_discrete(limits = rev(levels(data$race_eth2))) +
guides(color = guide_legend(label.position = "left", label.vjust = 0.5, label.hjust = 1, override.aes = list(size = 5)),
size = FALSE) +
labs(y = NULL,
color = NULL,
x = "Number of days",
title = str_wrap("For how many days during the past 30 days was your mental health not good?", width = 50),
subtitle = str_wrap("We show the average number of days without good mental health by race and ethnicity", width = 65),
caption = "Source: 2021 San Antonio Energy and Time Use Survey") +
theme_classic() +
themeuf